#!/bin/sh

export INGRESS_PROVIDER_DEST_PORT=80
export INGRESS_PROVIDER_VIP=192.168.1.201


errorExit() {
    echo "*** $*" 1>&2
    exit 1
}

curl --silent --max-time 2 --insecure https://localhost:${INGRESS_PROVIDER_DEST_PORT}/ -o /dev/null || errorExit "Error GET https://localhost:${INGRESS_PROVIDER_DEST_PORT}/"
if ip addr | grep -q ${INGRESS_PROVIDER_VIP}; then
    curl --silent --max-time 2 --insecure https://${INGRESS_PROVIDER_VIP}:${INGRESS_PROVIDER_DEST_PORT}/ -o /dev/null || errorExit "Error GET https://${INGRESS_PROVIDER_VIP}:${INGRESS_PROVIDER_DEST_PORT}/"
fi